package com.example.fj2889.yuedongplayer;

import android.app.Fragment;
import android.content.Context;
import android.media.Image;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

/**
 * Created by fj2889 on 2017/6/20.
 */
public class VideoAdapter extends ArrayAdapter<Video> {
    private int resourceId;
    public VideoAdapter(Context context, int textViewResourceId, List<Video> objects){
        super(context,textViewResourceId,objects);
        resourceId=textViewResourceId;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent){
        Video video=getItem(position);
        View view= LayoutInflater.from(getContext()).inflate(resourceId,null);
        TextView videoName=(TextView)view.findViewById(R.id.video_name);
        //ImageView videoImage=(ImageView)view.findViewById(R.id.video_image);
        //videoImage.setImageResource(R.drawable.video);
        videoName.setText(video.getName());
        return view;
    }
}
